﻿using Microsoft.Practices.Unity.Utility;
using Microsoft.VisualStudio.TextTemplating;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Artech.CodeGeneration
{
    public static class TextTransformationExtensions
    {
        public static void RunCodeGenerator(this TextTransformation transformation, ITextTemplatingEngineHost host, Generator generator)
        {
            Guard.ArgumentNotNull(transformation, "transformation");
            Guard.ArgumentNotNull(host, "host");
            Guard.ArgumentNotNull(generator, "generator");

            using (TransformContextScope contextScope = new TransformContextScope(transformation, host))
            {
                generator.Run();
            }
        }
    }
}
